import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
          colorScheme: const ColorScheme(
              primary: Colors.black,
              surfaceVariant: Colors.white,
              secondary: Colors.green,
              background: Colors.white, //整个页面背景色
              error: Colors.red,
              brightness: Brightness.light,
              onBackground: Colors.white,
              outlineVariant: Colors.white,
              onError: Colors.yellow,
              onPrimary: Colors.white,
              onSecondary: Colors.white,
              onSurface: Color.fromARGB(255, 233, 233, 240),
              surface: Color.fromARGB(255, 17, 0, 255)) //整个标题栏颜色
          // primarySwatch: Colors.blue, // 设置主色调,无效，怎么设都是白色
          ),
      home: Scaffold(
        appBar: AppBar(title: const Text("图标"), centerTitle: true),
        body: MyHomePage(),
      ),
    );
  }
}

// ignore: must_be_immutable
class MyHomePage extends StatelessWidget {
  late List<String> list = [];
  MyHomePage({super.key}) {
    for (var i = 0; i < 20; i++) {
      list.add("我是第$i条数据");
    }
  }

  @override
  Widget build(BuildContext context) {
    return ListView.builder(
        itemCount: list.length,
        itemBuilder: (context, index) {
          return ListTile(
              title: Text(list[index],
                  style: const TextStyle(color: Colors.black)));
        });
  }
}
